/**
 * Created by 123 on 2017/12/26.
 */
import apiPath from '../utils/apiPath';
import callApi  from '../utils/callApi';

/**
 * 获取项目及监督人员
 * @returns {Promise.<*>}
 */
export async function queryTaskForm(val) {
  const {json, error} = await callApi(GLOBAL.INT.taskForm,val);
  if (error) {
    return {error: error.message}
  }
  return {res: json}

}
/**
 *添加任务台账
 * @returns {Promise.<*>}
 */
export async function taskSave(param) {
  const {json, error} = await callApi(GLOBAL.INT.taskSave, param, 'POST');

  if (error) {
    return {error: error.message}
  }
  return {res: json}

}
/**
 * 启用任务
 * @param param
 * @returns {Promise.<*>}
 */
export async function taskEnable(param) {
  const {json, error} = await callApi(GLOBAL.INT.taskEnable, param);

  if (error) {
    return {error: error.message}
  }
  return {res: json}

}

/**
 * 站长下发的任务 列表
 * @param param
 * @returns {Promise.<*>}
 */
export async function findMasterTask(param) {
  const {json, error} = await callApi(GLOBAL.INT.findMasterTask, param);

  if (error) {
    return {error: error.message}
  }
  return {res: json}

}